// poages/initiateMatch/initiateMatch.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    form_opponent_class: "",
    form_date_class: "",
    form_site_class: "",
    form_price_class: "",
    form_peoplenum_class:"",
    form_trailnotice_class:""
  },
  /**
  * input 获取焦点事件
  */
  watchInputfocus: function (event) {

    var id = event.currentTarget.id
    if (id == "input_opponent") {
      this.setData({
        form_opponent_class: "form-control-focus"
      });
    } else if (id == "input_date") {
      this.setData({
        form_date_class: "form-control-focus"
      });
    } else if (id == "input_site") {
      this.setData({
        form_site_class: "form-control-focus"
      });
    } else if (id == "input_price") {
      this.setData({
        form_price_class: "form-control-focus"
      });
    } else if (id == "input_peoplenum") {
      this.setData({
        form_peoplenum_class: "form-control-focus"
      });
    } else if (id == "input_trailnotice") {
      this.setData({
        form_trailnotice_class: "form-control-focus"
      });
    }

  },
  /**
  * input 离开焦点事件
  */
  watchInputblur: function (event) {
    var id = event.currentTarget.id
    if (id == "input_opponent" && event.detail.value == "") {
      this.setData({
        form_opponent_class: ""
      });
    } else if (id == "input_opponent" && event.detail.value != "") {
      this.setData({
        form_opponent_class: "form-control-focus-gray"
      });
    }
    if (id == "input_date" && event.detail.value == "") {
      this.setData({
        form_date_class: ""
      });
    } else if (id == "input_date" && event.detail.value != "") {
      this.setData({
        form_date_class: "form-control-focus-gray"
      });
    }

    if (id == "input_site" && event.detail.value == "") {
      this.setData({
        form_site_class: ""
      });
    } else if (id == "input_site" && event.detail.value != "") {
      this.setData({
        form_site_class: "form-control-focus-gray"
      });
    }

    if (id == "input_price" && event.detail.value == "") {
      this.setData({
        form_price_class: ""
      });
    } else if (id == "input_price" && event.detail.value != "") {
      this.setData({
        form_price_class: "form-control-focus-gray"
      });
    }

    if (id == "input_peoplenum" && event.detail.value == "") {
      this.setData({
        form_peoplenum_class: ""
      });
    } else if (id == "input_peoplenum" && event.detail.value != "") {
      this.setData({
        form_peoplenum_class: "form-control-focus-gray"
      });
    }

    if (id == "input_trailnotice" && event.detail.value == "") {
      this.setData({
        form_trailnotice_class: ""
      });
    } else if (id == "input_trailnotice" && event.detail.value != "") {
      this.setData({
        form_trailnotice_class: "form-control-focus-gray"
      });
    }

  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})